/* style.css */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #4169E1;
    --background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--background);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.vis-node.expanded {
    border: 2px solid #4169E1; /* 展开的节点边框颜色 */
}

/* 主页  ================================================================================= */

/* 标题栏 */
.header {
    background: white;
    color: var(--primary-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    height: 76px;
}

.nav-links {
    display: flex;
    gap: 0.5rem; /* 减少按钮之间的间距 */
    align-items: center;
}

.nav-links a, .nav-links button {
    color: var(--primary-color);
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem; /* 稍微减小字体大小 */
    padding: 0.5rem 1rem; /* 减少内边距 */
    border-radius: 8px;
    background-color: white;
    transition: all 0.3s ease;
}

.nav-links a:hover, .nav-links button:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.nav-links a i, .nav-links button i {
    margin-right: 0.3rem; /* 减少图标与文字的间距 */
}

/* 洞察按钮 */
#start-insight-btn {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    padding: 1rem 2rem;
    font-size: 1.7rem;
    background: #4a5957;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}
#start-insight-btn:hover {
    opacity: 0.9;
    transform: translateX(-50%) translateY(-3px);
}

/* 中央图谱容器 */
.graph-container {
    flex-grow: 1; /* 占满剩余空间 */
    position: relative; /* 新增 */
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin: 1rem; /* 保留外部间距 */
}

#network-home {
    position: absolute; /* 新增 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.vis-node {
    transition: opacity 0.3s ease, transform 0.6s ease;
}

/* 悬浮按钮组 */
.floating-buttons {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 0.5rem;
    z-index: 1000;
}

.floating-buttons button {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.floating-buttons button.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.floating-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 资产概览容器 */
#asset-overview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 999;
    padding: 1rem;
    overflow-y: auto;
}

#asset-overview.hidden {
    display: none;
}

/* 图表容器 */
.chart-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.chart {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    top: 50px;
    width: 100%;
    height: 400px;
}

/* 隐藏节点时的样式 */
.vis-node.hidden {
    opacity: 0;
    transform: scale(0.8);
}


/* 右侧边栏 */
#sidebar {
    position: fixed;
    right: 0;
    top: 77px;
    height: calc(100vh - 77px); /* 与页面等高 */
    width: 300px;
    background: white;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    z-index: 1000;
}

/* 边栏收起状态 */
#sidebar.collapsed {
    transform: translateX(100%);
}

/* 边栏头部 */
.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--primary-color);
}

/* 边栏内容 */
.sidebar-content {
    padding: 1rem;
    overflow-y: auto;
    height: calc(100vh - 77px - 50px);
}

/* 筛选条件组 */
.filter-group {
    margin-bottom: 1rem;
}

.filter-title {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.filter-title input {
    margin-right: 0.5rem;
}

.filter-title i {
    margin-left: auto;
    transition: transform 0.3s ease;
}

/* 子条件 */
.sub-conditions {
    padding-left: 1.5rem;
    margin-top: 0.5rem;
    display: none;
}

.sub-conditions label {
    display: block;
    margin: 0.5rem 0;
}

/* 展开状态 */
.filter-group.expanded .sub-conditions {
    display: block;
}

.filter-group.expanded .filter-title i {
    transform: rotate(180deg);
}

/* 边栏伸缩按钮 */
#toggle-sidebar {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: right 0.3s ease;
}

#toggle-sidebar i {
    font-size: 1rem;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

/* 边栏展开时按钮位置 */
#sidebar:not(.collapsed) + #toggle-sidebar {
    right: 280px; /* 边栏宽度 */
}

/* 边栏展开时箭头方向 */
#sidebar:not(.collapsed) + #toggle-sidebar i {
    transform: rotate(180deg);
}

/* 洞察页面  ================================================================================= */

.main-container {
    display: flex;
    height: calc(100vh - 68px);
    padding: 1rem;
    gap: 1rem;
}

.chat-panel {
    width: 40%;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-history {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: #fcfdff;
}

.chat-message {
    margin: 1rem 0;
    padding: 1rem;
    max-width: 80%;
    border-radius: 12px;
    position: relative;
    animation: fadeIn 0.3s ease;
}

.user-message {
    background: var(--secondary-color);
    color: white;
    margin-left: auto;
    border-radius: 12px 12px 0 12px;
}

.system-message {
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.user-input {
    padding: 1rem;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 0.5rem;
    position: relative;
}

#question-input {
    flex: 1;
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

#question-input:focus {
    border-color: var(--secondary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.1);
}

.send-btn {
    padding: 0.8rem 1.5rem;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.send-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.graph-panel {
    width: 60%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    max-height: calc(100vh - 68px - 2rem);
}

.analysis-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    flex-shrink: 0;
}

.box-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    background: #7a7f85;
}

.box-title {
    font-weight: 600;
    color: white;
}

.box-content {
    display: grid;
    grid-template-columns: 60% 40%;
    height: 300px;
    overflow-y: auto;
}

.graph-section {
    border-right: 1px solid #eee;
    padding: 1rem;
    height: 300px;
    overflow: hidden;
    background: white;
    position:relative;
}

.advice-section {
    padding: 1.5rem; /* 新增 */
    background: #fcfdff; /* 新增 */
    border-left: 1px solid #eee; /* 新增 */
    height: 100%; /* 新增 */
    display: flex; /* 新增 */
    flex-direction: column; /* 新增 */
    gap: 1rem; /* 新增 */
}

.advice-section h4 {
    font-size: 1.1rem; /* 新增 */
    color: var(--primary-color); /* 新增 */
    margin-bottom: 0.5rem; /* 新增 */
    font-weight: 600; /* 新增 */
}

.advice-section ul {
    list-style: none; /* 新增 */
    padding: 0; /* 新增 */
    margin: 0; /* 新增 */
    display: flex; /* 新增 */
    flex-direction: column; /* 新增 */
    gap: 0.75rem; /* 新增 */
}

.advice-section li {
    background: white; /* 新增 */
    padding: 0.75rem 1rem; /* 新增 */
    border: 1px solid #e0e0e0;
    border-radius: 8px; /* 新增 */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); /* 新增 */
    transition: all 0.3s ease; /* 新增 */
    display: flex; /* 新增 */
    align-items: center; /* 新增 */
    gap: 0.5rem; /* 新增 */
}

.advice-section li:hover {
    transform: translateY(-2px); /* 新增 */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* 新增 */
    background: var(--secondary-color); /* 新增 */
    color: white; /* 新增 */
}

.advice-section li i {
    color: var(--secondary-color); /* 新增 */
    font-size: 0.9rem; /* 新增 */
}

.advice-section li:hover i {
    color: white; /* 新增 */
}

#network {
    width: 100%;
    height: 100%;
}

#network1, #network2, #network3, #network4, #network5 {
    height: 100%;
    width: 100%;
    overflow: visible;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-menu {
    position: absolute;
    top: 50px;
    right: 0;
    background: var(--primary-color);
    border: 1px solid #ddd;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    list-style: none;
    padding: 0;
    margin: 0;
    z-index: 1000;
    display: none; /* 默认隐藏 */
}

.dropdown-menu li {
    padding: 10px;
    cursor: pointer;
    color: white; /* 白色文字 */
}

.dropdown-menu li:hover {
    background: #f0f0f0;
}

.suggestions {
    position: absolute;
    bottom: 100%; /* 将提示词放在输入框上方 */
    left: 0;
    right: 0;
    background: #fcfdff;
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    z-index: 1000;
    margin-bottom: 0.5rem; /* 与输入框的间距 */
}

.suggestions span {
    background: var(--background);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--secondary-color);
    transition: all 0.3s ease;
}

.suggestions span:hover {
    background: var(--secondary-color);
    color: white;
    flex-direction: column; /* 将提示词和标题垂直排列 */
    gap: 0.5rem; /* 标题和提示词之间的间距 */
}

.suggestions-title {
    font-size: 0.9rem;
    color: var(--secondary-color);
    font-weight: 600;
}

.suggestions-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* 初始页面样式 */
.landing-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    text-align: center;
}

.landing-page h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 2rem;
}

